package com.example.demo.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

/**
 * 系统启动运行器
 */
@Configuration
@Order(1)
public class StartupRunner implements CommandLineRunner {

    private static final Logger logger = LoggerFactory.getLogger(StartupRunner.class);

    @Value("${server.port}")
    private String serverPort;

    @Value("${server.servlet.context-path}")
    private String contextPath;

    @Override
    public void run(String... args) {
        logger.info("==========================================================");
        logger.info("=                                                        =");
        logger.info("=              港口计费系统启动成功                        =");
        logger.info("=                                                        =");
        logger.info("=  后端接口地址: http://localhost:{}{}/                    =", serverPort, contextPath);
        logger.info("=  Swagger文档: http://localhost:{}{}/swagger-ui.html    =", serverPort, contextPath);
        logger.info("=                                                        =");
        logger.info("=  前端地址: http://localhost:3000/                       =");
        logger.info("=  初始账号: admin                                        =");
        logger.info("=  初始密码: 123456                                       =");
        logger.info("=                                                        =");
        logger.info("==========================================================");
    }
} 